package cn.edu.lsnu.mbti.service.impl;

import cn.edu.lsnu.mbti.entity.Type;
import cn.edu.lsnu.mbti.mapper.TypeMapper;
import cn.edu.lsnu.mbti.service.TypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper,Type> implements TypeService {

    @Resource
    private TypeMapper typeMapper;


    /**
     * 查询类型集合
     * @return
     */
    @Override
    public List<Type> queryTypeList() {
        return Optional.ofNullable(typeMapper.selectList(null)).orElse(new ArrayList<>());
    }
}
